<?php
namespace Pw\MainBundle\Classes;
class ColorTag extends Tag
{
	public function __construct(){
		parent::__construct('color', null, null);
	}
	public function isParamAllowed($param, $value){
		$value = intval($value, 16);
		if ($param === '_self' && $value <= 16777215 && $value > 1) {
			return true;
		}
		return false;
	}
	public function getRepalceOpen() {
		$res = '<span';
		if (isset($this->params['_self'])) {
			$res .= ' style="color:#' . $this->params['_self'] . '"';
		}
		$res .= '>';
		return $res;
	}
	public function getRepalceClose() {
		return '</span>';
	}
}
